<template>
	<view class="codelist bgc_fff">
		<view class="flex theader">
			<view class="th th1">活动编码</view>
			<view class="th th2">活动名称</view>
			<view class="th th3">兑奖码</view>
			<view class="th th4">获取时间</view>
		</view>
		<view class="tdcontent">
			<view class="tditem flex" v-for="(item,index) in list_code" :key="index">
				<view class="td th1 otw">{{ item.id }}</view>
				<view class="td th2 otw">{{ item.task.name }}</view>
				<view class="td th3 otw">{{ item.code }}</view>
				<view class="td th4 otw"> {{ item.create_time }}</view>
			</view>
			<view v-if="list_code.length" class="">
				<p v-if="showMore" class="tac mt20 mb50" @click="loadMore">点击加载更多</p>
				<p v-else class="tac mt20 mb50">没有更多了</p>
			</view>
			<view v-if="list_code.length==0" class="tac empty">
				暂无数据
			</view>
		</view>
		<!-- <view class="content" v-if="taskList.length">
            <view class="row clearfix mb20" v-for="(item, index) in taskList" :key="index" @click="jumpPage(item)">
                <image :src="`/${item.template.url}`" alt=""></image>
                <p v-for="(i, idx) in item.task_draw" :key="index+'_'+idx">
                    {{ `${i.level_name}: ${i.draw_name}*${i.draw_num}` }}
                </p>
                <p v-if="item.task_comfort">{{ `${item.task_comfort.level_name}: ${item.task_comfort.draw_name}*${item.task_comfort.draw_num}` }}</p>
                <p class="line"></p>
                <p class="fl">{{ type2[item.type] }}</p>
                <p class="fr c_C30000 fwb">{{ type1[item.status] }}</p>
            </view>
            <p v-if="showMore" class="tac mt20 mb50" @click="
			">点击加载更多</p>
            <p v-else class="tac mt20 mb50">没有更多了</p>
        </view> -->
	</view>
</template>
<script>
	// status 已发布 4 已借su 0 daifabu
	// type 1 jichoujikai  2 dingshikaijiang 3满人开奖
	const type1 = {
		1: '已发布',
		0: '待发布',
		4: '已结束'
	}
	const type2 = {
		1: '即抽即开',
		2: '定时开奖',
		3: '满人开奖'
	}
	export default {
		props: ["taskId"],
		data() {
			return {
				type1,
				type2,
				taskList: [{
					id: 1
				}],
				type: '1',
				page: 1,
				num: 10,
				showMore: true,
				list_code: []
			}
		},
		methods: {
			back() {
				uni.navigateBack();
			},
			getCodeList() {
				console.log("getCodeList")
				console.log(this.taskId)
				uni.$http.post('/wxuser/public/drawCodeList', {
					id: this.taskId,
					num: 20,
					page: this.page
				}).then((res) => {
					if (res.data.data.list.length) {
						this.list_code.push(...res.data.data.list);
					} else {
						this.showMore = false;
					}


				})
			},


			loadMore() {
				this.page++;
				this.getCodeList();
			}

		},
		mounted() {
			this.getCodeList();
		}
	}
</script>
<style lang="scss" scoped>
	.codelist {
		box-sizing: border-box;
		border-radius: 25rpx;
		overflow: hidden;
		height: 100%;

		.theader {
			box-sizing: border-box;
			width: 100%;
			border-bottom: 1px solid #707070;
			font-size: 26rpx;
			color: #000;
			padding: 22rpx 12rpx;
		}

		.th1,
		.th3,
		.th4 {
			width: 20%;
		}

		.th2 {
			width: 40%
		}

		.tdcontent {
			color: #4A4A4A;
			font-size: 26rpx;
			height: 100%;
			height: calc(100% - 80rpx);
			// min-height: calc(100vh - 300rpx);
			overflow-y: auto;

		}

		.tditem {
			padding: 20rpx 12rpx;
			border-bottom: 1px solid #C6C6C6;
		}

		// .content {
		//     .row {
		//         background-color: #fff;
		//         padding: 20rpx;
		//         border-radius: 20rpx;
		//         image {
		//             width: 100%;
		//             border-radius: 20rpx;
		//         }
		//         p {
		//             line-height: 50rpx;
		//         }
		//         .line {
		//             margin: 10rpx 0;
		//             border-top: 1px dashed #707070;
		//         }
		//         .c_C30000 {
		//             color: #C30000;
		//         }
		//     }
		// }
		.empty {
			position: absolute;
			top: 50%;
			left: 50%;
			transform: translateX(-50%);
		}
	}
</style>